﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class eje1 : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }

    protected void btnGenerarTabla_Click(object sender, EventArgs e)
    {
        lblTbl.Text = string.Empty;
        if (txtCant1.Text == "" || txtCant2.Text == "" || txtProd1.Text == "" || txtProd1.Text == "")
        {
            lblTbl.Text = "Porfavor complete todos los campos";
            lblTbl.ControlStyle.ForeColor = System.Drawing.Color.Red;
            return;
        }
        string formatTable = string.Empty;
        lblTbl.ControlStyle.ForeColor = System.Drawing.Color.Black;
        formatTable = "<table border='1'><tr><td>Producto</td><td>Cantidad</td></tr>" +
            "<tr><td>" + txtProd1.Text.Trim() + "</td> <td> " + txtCant1.Text.Trim() + " </td></tr>" +
            "<tr><td>" + txtProd2.Text.Trim() + "</td> <td> " + txtCant2.Text.Trim() + " </td></tr>" +
            "<tr><td>TOTOAL:</td> <td> " + (int.Parse(txtCant1.Text.Trim()) + int.Parse(txtCant2.Text.Trim())) + " </td></tr>" +
            "</table>";
        lblTbl.Text = formatTable;
    }
}